Pubs of the UK

Reading the data

Download the dataset from kaggle - you need to be logged in to download the dataset. See https://www.kaggle.com/getthedata/open-pubs/downloads/open_pubs.csv/1 We set the variable names as described in the documentation.

library(leaflet)
## Warning: package 'leaflet' was built under R version 3.5.3
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
df <- read.csv("open_pubs.csv",sep=",", header = FALSE,col.names=c("fsa_id","name","address","postcode","easting","northing","lat","lng","local_authority"))
df$lat <- as.numeric(as.character(df$lat))
## Warning: NAs durch Umwandlung erzeugt
df$lng <- as.numeric(as.character(df$lng))
## Warning: NAs durch Umwandlung erzeugt

Visualizing the data

See below an interactive map of the pubs of the UK.

df %>% leaflet() %>% addTiles() %>% addMarkers(popup = df$name,label = df$name,clusterOptions = markerClusterOptions())
## Assuming "lng" and "lat" are longitude and latitude, respectively
## Warning in validateCoords(lng, lat, funcName): Data contains 63 rows with
## either missing or invalid lat/lon values and will be ignored